﻿namespace FSLib

type FilterSilver() =
    interface IFilter2D with

        member this.FilterName = "Silver"
        member this.Description = "モノクロ化（輝度）"

        // 輝度によるグレースケール化
        member this.Compute mat:int[,] =
            
            let luminance x =
                let (r,g,b) = CommonUtils.toRGBF (x)
                let y = int( 0.299*r + 0.587*g + 0.114*b )
                CommonUtils.toValue (y,y,y)
                
            Array2D.map luminance mat
